/*
 * Powered By [verywell-framework]
 *
 * Since 2013 - 2014
 */

package com.njmd.mdbs.web.entity.sys;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.njmd.mdbs.web.entity.AuditableEntity;

@Entity
@Table(name = "SYS_CONFIG")
public class SysConfig extends AuditableEntity implements java.io.Serializable
{
	private static final Long serialVersionUID = 1L;

	public static final String PRODUCT_NAME = "Product.name";
	public static final String PRODUCT_VERSION = "Product.version";
	public static final String PRODUCT_VERSIONCODE = "Product.versioncode";
	public static final String LICENSE_TYPE = "License.type";
	public static final String LICENSE_EXPIRY = "License.expiry";
	public static final String LICENSE_IPS = "License.ips";
	public static final String LICENSE_MENUS = "License.menus";
	public static final String SERVER_MACADDRESS = "Server.macaddress";
	public static final String SIGNATURE = "Signature";
	public static final String MDWS_NUM="MDWS.num";
	public static final String MDWS4PC_NUM="MDWS4PC.num";

	public static final String ALLOW_IPS = "allow.ips";
	public static final String DENY_IPS = "deny.ips";

	public static final String CAPTCHA = "captcha";

	public static final String WORKSTATION_IPS = "ws.ips";

	public static final String PUBLIC_NUM = "public.num";
	public static final String PRIVATE_NUM = "private.num";

	public static final String IS_LICENSE_OK = "isLicenseOk";
	public static final String IS_EXPIRY = "isExpiry";

	public static final String WS_OFFLINE = "ws.offline";

	// 月份开始日期
	public static final String MONTH_START = "month.start";
	// 月份结束日期
	public static final String MONTH_END = "month.end";

	public static final String CONVERT2FLV_ENABLE = "convert2Flv.enable";

	public static final String CONVERT2FLV_FILESIZE = "convert2Flv.fileSize";

	public static final String CONVERT2FLV_FILETYPES = "convert2Flv.fileTypes";

	public static final String NTP_SERVER="ntp.server";
	
	// 文件类型1代表图片类型，二代表文本类型
	public static final String Message = "1,2";
	private java.lang.Long id;
	private java.lang.Long parentId;
	private java.lang.String code;
	private java.lang.String value;
	private java.lang.String configName;
	private java.lang.String configDesc;
	private java.lang.String defaultVal;
	private java.lang.String validateRule;
	private Integer viewFlag;
	private Integer valType;
	private java.lang.String valValues;
	private Integer status;

	public SysConfig()
	{
	}

	public SysConfig(java.lang.Long id)
	{
		this.id = id;
	}

	public void setId(java.lang.Long value)
	{
		this.id = value;
	}

	@Id
	@GeneratedValue(generator = "SYS_CONFIG_GENERATOR", strategy = GenerationType.SEQUENCE)
	@SequenceGenerator(name = "SYS_CONFIG_GENERATOR", sequenceName = "SEQ_SYS_CONFIG", allocationSize = 1)
	@Column(name = "ID")
	public java.lang.Long getId()
	{
		return this.id;
	}

	@Column(name = "PARENT_ID", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Long getParentId()
	{
		return this.parentId;
	}

	public void setParentId(java.lang.Long value)
	{
		this.parentId = value;
	}

	@Column(name = "CODE", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public java.lang.String getCode()
	{
		return this.code;
	}

	public void setCode(java.lang.String value)
	{
		this.code = value;
	}

	@Column(name = "VAL", unique = false, nullable = true, insertable = true, updatable = true, length = 4000)
	public String getValue()
	{
		if (null == value)
			return "";
		return value;
	}

	public void setValue(java.lang.String value)
	{
		this.value = value;
	}

	@Column(name = "CONFIG_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getConfigName()
	{
		return this.configName;
	}

	public void setConfigName(java.lang.String value)
	{
		this.configName = value;
	}

	@Column(name = "CONFIG_DESC", unique = false, nullable = true, insertable = true, updatable = true, length = 400)
	public java.lang.String getConfigDesc()
	{
		return this.configDesc;
	}

	public void setConfigDesc(java.lang.String value)
	{
		this.configDesc = value;
	}

	@Column(name = "DEFAULT_VAL", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getDefaultVal()
	{
		return this.defaultVal;
	}

	public void setDefaultVal(java.lang.String value)
	{
		this.defaultVal = value;
	}

	@Column(name = "VALIDATE_RULE", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getValidateRule()
	{
		return this.validateRule;
	}

	public void setValidateRule(java.lang.String value)
	{
		this.validateRule = value;
	}

	@Column(name = "VIEW_FLAG", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getViewFlag()
	{
		return this.viewFlag;
	}

	public void setViewFlag(Integer value)
	{
		this.viewFlag = value;
	}

	@Column(name = "VAL_TYPE", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getValType()
	{
		return this.valType;
	}

	public void setValType(Integer value)
	{
		this.valType = value;
	}

	@Column(name = "VAL_VALUES", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getValValues()
	{
		return this.valValues;
	}

	public void setValValues(java.lang.String value)
	{
		this.valValues = value;
	}

	@Column(name = "STATUS", unique = false, nullable = true, insertable = true, updatable = true, length = 2)
	public Integer getStatus()
	{
		return this.status;
	}

	public void setStatus(Integer value)
	{
		this.status = value;
	}

	// 文件类型
	private String fileType = null;

	@Transient
	public String getFileType()
	{
		return fileType;
	}

	public void setFileType(String fileType)
	{
		this.fileType = fileType;
	}

	public String toString()
	{
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("Id", getId()).append("ParentId", getParentId())
				.append("Code", getCode()).append("Val", getValue()).append("ConfigName", getConfigName())
				.append("ConfigDesc", getConfigDesc()).append("DefaultVal", getDefaultVal()).append("ValidateRule", getValidateRule())
				.append("ViewFlag", getViewFlag()).append("ValType", getValType()).append("ValValues", getValValues())
				.append("Status", getStatus()).append("CreateBy", getCreateBy()).append("CreateTime", getCreateTime())
				.append("LastModifyBy", getLastModifyBy()).append("LastModifyTime", getLastModifyTime()).toString();
	}

	public int hashCode()
	{
		return new HashCodeBuilder().append(getId()).toHashCode();
	}

	public boolean equals(Object obj)
	{
		if (obj instanceof SysConfig == false)
			return false;
		if (this == obj)
			return true;
		SysConfig other = (SysConfig) obj;
		return new EqualsBuilder().append(getId(), other.getId()).isEquals();
	}

}
